package demo.DataStrucAndAlgo.Easy_pritice;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/10/16-10-16-10:57
 * @Description：demo.DataStrucAndAlgo.Easy_pritice
 */
public class NewCodeTest1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();

        Set<String> set = new HashSet();
        if(str1.equals(str2)){
            set.add(str1);
        }else if(str1.length() != str2.length()){
            String temp1 = null;
            String temp2 = null;
            if(str1.length()> str2.length()){
                temp1 = str2;
                temp2 = str1;

            }else {
                temp1 = str1;
                temp2 = str2;
            }

            for (int i = 0; i < temp1.length()-1; i++) {
                for (int j = i+ 1; j < temp1.length(); j++) {
                    if(temp2.contains(temp1.substring(i,j))){
                        set.add(temp1.substring(i,j));
                    }
                }
            }
        }
        System.out.println(set.size());
    }
}
